-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle multiple file changes. #296
base: master
Are you sure you want to change the base?
Conversation
Without it if multiple changes occured at once, it will try to start process multiple times.
@bjornstar are you going to review this somehow? |
@bjornstar see please) |
I see test failures, and no tests to validate the behavior. |
Well, I've tried to reproduce the problem with tests, and could not: I'm pretty sure that in my case I see that multiple file changes happened at once resulted in multiple Btw if to add: watcher.on('change', file => {
if (isPaused) return;
isPaused = true; I don't see any current tests failing. |
@bjornstar So it seems that this case is is not easy to reproduce in tests. But logically it should be understood that this: watcher.on('change', file => {
if (isPaused) return;
isPaused = true; allows to prevent consequent changes that should not be handled. What do you think? |
hi @bjornstar, i use this PR as a patch and test:
and works fine 🔥 prevents a lot of unnecessary restarts. @wclr good work |
@bjornstar Look at this again please, this is a simple logical change that we will NOT handle any changes as soon as Current:
With change: watcher.on('change', file => {
if (isPaused) return;
isPaused = true;
clearOutput();
notify('Restarting', `${file} has been modified`);
watcher.removeAll();
if (child) {
// Child is still running, restart upon exit
child.on('exit', start); |
Without it if multiple changes occured at once, it will try to start process multiple times.